package com.bw.shop_2302

import android.content.Intent
import com.bumptech.glide.Glide
import com.bw.base.mvvm.BaseActivity
import com.bw.shop_2302.update.UpdateActivity
import com.bw.shop_2302.user.UserViewModel
import com.bw.shop_2302.databinding.ActivityUser2Binding


class UserActivity2 : BaseActivity<ActivityUser2Binding,UserViewModel>() {
    override fun initView() {
        viewModel.user()


        binding.tvPassword2.setOnClickListener {


            startActivity(Intent(this,UpdateActivity::class.java))

        }

    }

    override fun initData() {


        viewModel.usersuccess.observe(this){

            if(it.code==200){


                binding.tvName2.text=it.data.nickname
                binding.tvPhone2.text=it.data.phone
                Glide.with(this).load(it.data.avatar).circleCrop().into(binding.ivUsericon)

            }

        }

    }

    override fun getviewmodel(): Class<UserViewModel>  =UserViewModel::class.java

    override fun getLayoutID(): Int = R.layout.activity_user2

}